<template>
	<view>
		<view class="qui-cells">
			<navigator url="/pages/test-page/test-page" class="qui-cell">
				<view class="cell-bd">
					修改资料
				</view>
				<view class="arrow-r"></view>
			</navigator>
			<view class="qui-cell" @click="logout" >
				<view class="cell-bd">
					退出登录
				</view>
				<view class="arrow-r"></view>
			</view>
		</view>
		
		
		<uni-popup ref="popup" type="dialog">
			<uni-popup-dialog
				type="input"
				content="确定要退出登录吗？"
				message="成功消息"
				:duration="2000"
				:before-close="true"
				@close="close"
				@confirm="confirm"
			></uni-popup-dialog>
		</uni-popup>
		
	</view>
</template>

<script>
import uniPopup from '@/components/uni-popup/uni-popup.vue';
import uniPopupMessage from '@/components/uni-popup/uni-popup-message.vue';
import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue';
export default {
	components: {
		uniPopup,
		uniPopupMessage,
		uniPopupDialog
	},
	data() {
		return {
			
		};
	},
	methods: {
		
		logout() {
			this.$refs.popup.open();
		},
		close(done) {
			done();
		},
		confirm(done, value) {
			// 退出登录请求
			this.post('/api/user/logout').then(res => {
				uni.showToast({
					icon: 'none',
					title: '成功退出登录~'
				});
				uni.setStorageSync('token', '');
				uni.setStorageSync('userInfo', '');
				uni.reLaunch({
					url: '/pages/login/login'
				});
			});
		}
	}
};
</script>

<style></style>
